<template>
  <div id="app">
    <div class="app-container">
      <!-- 顶部导航栏 -->
      <header class="navbar">
        <div class="nav-container">
          <div class="nav-brand" @click="goHome">
            <img src="/src/assets/images/logo.png" alt="豆酱影评" class="brand-logo">
          </div>

          <nav class="nav-menu">
            <div
                v-for="item in menuItems"
                :key="item.id"
                class="nav-item"
                :class="{ active: activeMenu === item.id }"
                @click="switchMenu(item.id)"
            >
              {{ item.name }}
            </div>
          </nav>

          <div class="nav-right">
            <el-input
                class="nav-search"
                v-model="searchText"
                placeholder="搜索电影、导演、演员..."
                prefix-icon="el-icon-search"
                clearable
                @keyup.enter="handleSearch"
            />

            <el-dropdown @command="handleUserCommand" trigger="click">
              <div class="user-menu">
                            <div class="user-info">
              <div class="user-name">{{ authStore.user ? authStore.user.username : '电影爱好者' }}</div>
            </div>
                <img
                    class="user-avatar"
                    :src="getUserAvatar()"
                    @error="handleAvatarLoadError"
                    alt="用户头像"
                />
              </div>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item command="profile" icon="el-icon-user">个人主页</el-dropdown-item>
                  <el-dropdown-item command="watchlist" icon="el-icon-collection">我的片单</el-dropdown-item>
                  <el-dropdown-item command="reviews" icon="el-icon-edit">我的影评</el-dropdown-item>
                  <el-dropdown-item command="logout" icon="el-icon-switch-button">退出登录</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </div>
      </header>
      <!-- 主内容区域 -->
      <main class="main-content">
        <div class="content-wrapper">
          <div class="content-header" v-if="activeMenu !== 'report'">
            <h1 class="content-title">{{ getCurrentTitle() }}</h1>
            <p class="content-subtitle">{{ getCurrentSubtitle() }}</p>
          </div>

          <div class="content-body" :class="{ 'ai-body': activeMenu === 'report' }">
            <!-- 选电影模块 -->
            <div v-if="activeMenu === 'movies'" class="module-content">
              <MovieIndex/>

            </div>



            <!-- 影评模块 -->
            <div v-else-if="activeMenu === 'reviews'" class="module-content">
              <div class="reviews-container">
                <!-- 热门评论排行榜 -->
                <div class="hot-comments-section">
                  <h3 class="section-title">🔥 热门评论排行榜</h3>
                  <div v-if="hotComments.length === 0" class="empty-state">
                    <div class="empty-icon">📝</div>
                    <div class="empty-text">暂无热门评论</div>
                  </div>
                  <div v-else class="hot-comments-list">
                    <div v-for="(comment, index) in hotComments" :key="comment.id" class="hot-comment-item">
                      <div class="ranking-number">{{ index + 1 }}</div>
                      <div class="comment-content">
                        <div class="comment-text">{{ comment.content }}</div>
                        <div class="comment-meta">
                          <span class="comment-author" @click="goToUserProfile(comment.userId)" style="cursor: pointer; color: #667eea; font-weight: 600;">{{ comment.username }}</span>
                          <span class="comment-movie" @click="goToMovieDetail(comment.movieId)" style="cursor: pointer; color: #667eea;">《{{ getMovieById(comment.movieId)?.title || '未知电影' }}》</span>
                          <span class="comment-likes">👍 {{ comment.useful }}</span>
                          <span class="comment-date">{{ formatDate(comment.createdAt) }}</span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>



                  </div>
                          </div>

            <!-- 年度榜单模块 -->
            <div v-else-if="activeMenu === 'annual'" class="module-content">
              <div class="annual-section">
                <div class="annual-header">
                  <h2 class="annual-title">🎬 豆酱排行榜</h2>
                  <p class="annual-subtitle">探索本年度最精彩的电影作品和行业数据</p>
                          </div>
                
                <div class="annual-options">
                  <div class="option-card main-card" @click="goToAnnualMovie">
                    <div class="option-icon">📊</div>
                    <div class="option-content">
                      <h3 class="option-title">电影榜单</h3>
                      <p class="option-desc">查看最受欢迎演员、导演和完整的电影分类排行榜</p>
                      <div class="feature-tags">
                        <span class="feature-tag">🎭 人物榜</span>
                        <span class="feature-tag">🎬 电影榜</span>
                        <span class="feature-tag">📈 分类榜单</span>
                        </div>
                      </div>
                    <div class="option-arrow">→</div>
                  </div>
                </div>

                <div class="annual-stats">
                  <div class="stat-item">
                    <div class="stat-number">{{ totalMovies }}</div>
                    <div class="stat-label">电影总数</div>
                    </div>
                  <div class="stat-item">
                      <div class="stat-number">{{ activeUsers }}</div>
                      <div class="stat-label">活跃用户</div>
                    </div>
                  <div class="stat-item">
                    <div class="stat-number">{{ totalComments }}</div>
                    <div class="stat-label">评论总数</div>
                    </div>
                  <div class="stat-item">
                    <div class="stat-number">{{ totalRatings }}</div>
                    <div class="stat-label">评分总数</div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 豆酱AI模块 -->
            <div v-else-if="activeMenu === 'report'" class="ai-content">
              <DoujiangAI />
            </div>
          </div>
        </div>
      </main>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted, computed } from 'vue'
import { useAuthStore } from '@/store/authStore'
import { useRouter } from 'vue-router'
import commentApi from '@/api/comment/commentApi.js'
import ratingApi from '@/api/rating/ratingApi.js'
import movieApi from '@/api/movie/movieApi.js'
import reviewsApi from '@/api/reviews/reviewsApi.js'
import DoujiangAI from './DoujiangAI.vue'
import MovieIndex from '@/view/movie/index.vue'
import { processImageUrl } from '@/utils/imageUtils'
import { getUserAvatarUrl, handleAvatarError } from '@/utils/avatarUtils'
// import router from "../../router/index.js";
const authStore = useAuthStore();
const router = useRouter()

// 组件挂载时初始化认证状态
onMounted(() => {
  authStore.initializeAuth();
  loadUserReviews();
  loadHotReviewsData();
  
  // 检查URL参数，自动切换到指定菜单
  const urlParams = new URLSearchParams(window.location.search);
  const targetMenu = urlParams.get('activeMenu');
  if (targetMenu) {
    activeMenu.value = targetMenu;
  }
});

// 计算属性
const uniqueMovies = computed(() => {
  const movieIds = new Set();
  userComments.value.forEach(comment => movieIds.add(comment.movieId));
  userRatings.value.forEach(rating => movieIds.add(rating.movieId));
  return Array.from(movieIds);
});

// 加载用户影评数据
async function loadUserReviews() {
  if (!authStore.user) return;
  
  try {
    // 并行加载数据
    const [commentsRes, ratingsRes, moviesRes] = await Promise.all([
      commentApi.getUserComments(authStore.user.id),
      ratingApi.getUserRatings(authStore.user.id),
      movieApi.getAllMovies()
    ]);
    
    userComments.value = commentsRes.data;
    userRatings.value = ratingsRes.data;
    allMovies.value = moviesRes; // 注意这里不需要 .data，因为API已经处理过了
  } catch (error) {
    console.error('加载影评数据失败:', error);
  }
}

// 加载热门评论和电影数据
async function loadHotReviewsData() {
  try {
    // 并行加载数据
    const [hotCommentsRes, hotMoviesRes, statsRes] = await Promise.all([
      reviewsApi.getHotComments(10),
      reviewsApi.getHotMovies(10),
      reviewsApi.getReviewStats()
    ]);
    
    hotComments.value = hotCommentsRes.data;
    hotMovies.value = hotMoviesRes.data;
    
    // 处理统计数据
    const stats = statsRes.data;
    totalRatings.value = stats.totalRatings || 0;
    totalComments.value = stats.totalComments || 0;
    activeUsers.value = stats.activeUsers || 0;
    totalMovies.value = stats.totalMovies || 0;
  } catch (error) {
    console.error('加载热门数据失败:', error);
    // 如果API调用失败，使用默认值
    totalRatings.value = 0;
    totalComments.value = 0;
    activeUsers.value = 0;
    totalMovies.value = 0;
  }
}

// 根据ID获取电影信息
function getMovieById(movieId) {
  const movie = allMovies.value.find(movie => movie.id === movieId);
  if (movie && movie.poster) {
    // 确保海报URL经过代理处理
    movie.poster = processImageUrl(movie.poster);
  }
  return movie;
}

// 格式化日期
function formatDate(dateString) {
  if (!dateString) return '';
  const date = new Date(dateString);
  return date.toLocaleDateString('zh-CN');
}

// 删除评论
async function deleteComment(commentId) {
  if (!confirm('确定要删除这条评论吗？')) return;
  
  deletingComment.value = commentId;
  try {
    await commentApi.deleteComment(commentId);
    userComments.value = userComments.value.filter(comment => comment.id !== commentId);
    ElMessage.success('评论删除成功');
  } catch (error) {
    console.error('删除评论失败:', error);
    ElMessage.error('删除评论失败');
  } finally {
    deletingComment.value = null;
  }
}

// 删除评分
async function deleteRating(ratingId) {
  if (!confirm('确定要删除这条评分吗？')) return;
  
  deletingRating.value = ratingId;
  try {
    await ratingApi.deleteRating(ratingId);
    userRatings.value = userRatings.value.filter(rating => rating.id !== ratingId);
    ElMessage.success('评分删除成功');
  } catch (error) {
    console.error('删除评分失败:', error);
    ElMessage.error('删除评分失败');
  } finally {
    deletingRating.value = null;
  }
}

// 菜单项
const menuItems = [
  { id: 'movies', name: '选电影' },
  { id: 'reviews', name: '影评' },
  { id: 'annual', name: '豆酱榜单' },
  { id: 'report', name: '豆酱AI' }
]

// 当前激活菜单
const activeMenu = ref('movies')
// 搜索框内容
const searchText = ref('')


// 统计数据
const stats = reactive({
  totalMovies: 0,
  avgRating: 0,
  activeUsers: 0,
  totalReviews: 0,
  weeklyTop: 0,
  myReviews: 0,
  reviewLikes: 0,
  reviewViews: 0,
  watchedMovies: 0,
  watchTime: 0,
  favoriteGenre: ''
})

// 热门推荐电影
const featuredMovies = ref([])

// 排行榜电影
const topMovies = ref([])

// 影评相关数据
const userComments = ref([])
const userRatings = ref([])
const allMovies = ref([])
const deletingComment = ref(null)
const deletingRating = ref(null)

// 热门评论和电影数据
const hotComments = ref([])
const hotMovies = ref([])
const totalRatings = ref(0)
const totalComments = ref(0)
const activeUsers = ref(0)
const totalMovies = ref(0)

// 切换菜单
function switchMenu(id) {
  if (id === 'annual') {
    // 直接跳转到年度榜单页面
    router.push('/annual')
  } else {
  activeMenu.value = id
  }
}
// 回到首页
function goHome() {
  activeMenu.value = 'movies'
}
// 搜索事件
function handleSearch() {
  // 这里只做演示
  if (!searchText.value) return;
  router.push({
    path: `/searchMovie`,
    query: {q: searchText.value}
  });
}
// 用户下拉菜单事件
function handleUserCommand(cmd) {
  if (cmd === 'logout') {
    authStore.logout();
    router.push('/login')
  } else if (cmd === 'profile') {
    router.push('/profile')
  } else if (cmd === 'reviews') {
    // 跳转到个人影评页面
    router.push('/my-reviews')
  } else if (cmd === 'watchlist') {
    // 跳转到我的片单页面
    router.push('/my-watchlist')
  } else {
    // 其他菜单项暂时显示提示
    alert('功能开发中：' + cmd)
  }
}
// 当前标题
function getCurrentTitle() {
  const item = menuItems.find(i => i.id === activeMenu.value)
  return item ? item.name : ''
}
// 当前副标题
function getCurrentSubtitle() {
  switch (activeMenu.value) {
    case 'movies': return '发现好电影，开启观影之旅'
    case 'rankings': return '热门电影排行榜'
    case 'reviews': return '写下你的观影感受'
    case 'annual': return '年度佳片榜单'
    case 'report': return '豆酱AI助手'
    default: return ''
  }
}

// 获取用户头像
function getUserAvatar() {
  if (authStore.user && authStore.user.avatar) {
    return authStore.user.avatar;
  }
  return getUserAvatarUrl(authStore.user?.avatar);
}

// 处理头像加载失败
function handleAvatarLoadError(event) {
  handleAvatarError(event);
}

// 跳转到电影详情页面
function goToMovieDetail(movieId) {
  router.push({
    path: `/movie/${movieId}`,
    query: { from: activeMenu.value }
  });
}

// 跳转到年度电影榜单页面
function goToAnnualMovie() {
  router.push('/annual');
}

// 跳转到用户主页
function goToUserProfile(userId) {
  router.push(`/user/${userId}`);
}
</script>

<style scoped>
/* 这里粘贴原有 <style> 里的内容 */
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
      background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
      min-height: 100vh;
      color: #333;
    }

    .app-container {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    /* 顶部导航栏 */
    .navbar {
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
      position: sticky;
      top: 0;
      z-index: 1000;
      padding: 0 20px;
    }

    .nav-container {
      max-width: 1400px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 80px;
    }

    .nav-brand {
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      transition: transform 0.3s ease;
    }

    .nav-brand:hover {
      transform: scale(1.05);
    }

    .brand-logo {
      height: 180px;
      width: auto;
      transition: transform 0.3s ease;
      object-fit: contain;
    }

    .brand-text {
      font-size: 24px;
      font-weight: bold;
      background: linear-gradient(45deg, #667eea, #764ba2);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .nav-menu {
      display: flex;
      align-items: center;
      gap: 30px;
    }

    .nav-item {
      position: relative;
      padding: 12px 24px;
      font-size: 16px;
      font-weight: 500;
      color: #333;
      cursor: pointer;
      border-radius: 25px;
      transition: all 0.3s ease;
      white-space: nowrap;
    }

    .nav-item:hover {
      background: rgba(102, 126, 234, 0.1);
      color: #667eea;
      transform: translateY(-2px);
    }

    .nav-item.active {
      background: linear-gradient(45deg, #667eea, #764ba2);
      color: white;
      box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }

    .nav-item.active::after {
      content: '';
      position: absolute;
      bottom: -15px;
      left: 50%;
      transform: translateX(-50%);
      width: 6px;
      height: 6px;
      background: #667eea;
      border-radius: 50%;
    }

    .nav-right {
      display: flex;
      align-items: center;
      gap: 20px;
    }

    .search-container {
      position: relative;
    }

    .nav-search {
      width: 320px;
      height: 45px;
      border-radius: 25px;
      background: rgba(255, 255, 255, 0.8);
      border: 2px solid transparent;
      transition: all 0.3s ease;
    }

    .nav-search:focus {
      border-color: #667eea;
      background: white;
      box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
    }

    .user-menu {
      display: flex;
      align-items: center;
      gap: 15px;
      cursor: pointer;
      padding: 8px 16px;
      border-radius: 25px;
      transition: all 0.3s ease;
    }

    .user-menu:hover {
      background: rgba(255, 255, 255, 0.8);
    }

    .user-avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      border: 2px solid #667eea;
      transition: all 0.3s ease;
    }

    .user-avatar:hover {
      border-color: #764ba2;
      transform: scale(1.1);
    }

    .user-info {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }

    .user-name {
      font-size: 14px;
      font-weight: 600;
      color: #333;
    }

    .user-level {
      font-size: 12px;
      color: #667eea;
      font-weight: 500;
    }

    /* 主内容区域 */
    .main-content {
      flex: 1;
      padding: 40px 20px;
      max-width: 1400px;
      margin: 0 auto;
      width: 100%;
    }

    .content-wrapper {
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(20px);
      border-radius: 20px;
      min-height: 600px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* 内容标题区 */
    .content-header {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;
      padding: 30px 40px;
      position: relative;
      overflow: hidden;
    }

    .content-header::before {
      content: '';
      position: absolute;
      top: -50%;
      right: -10%;
      width: 100px;
      height: 200px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 50%;
      transform: rotate(45deg);
    }

    .content-title {
      font-size: 28px;
      font-weight: 700;
      margin-bottom: 8px;
      position: relative;
      z-index: 2;
    }

    .content-subtitle {
      font-size: 16px;
      opacity: 0.9;
      position: relative;
      z-index: 2;
    }

    /* 内容主体 */
    .content-body {
      padding: 40px;
    }

    .module-content {
      animation: fadeInUp 0.6s ease;
    }

    @keyframes fadeInUp {
      from {
        opacity: 0;
        transform: translateY(30px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* 电影卡片网格 */
    .movies-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
      gap: 25px;
      margin-bottom: 40px;
    }

    .movie-card {
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      cursor: pointer;
    }

    .movie-card:hover {
      transform: translateY(-8px);
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    }

    .movie-poster {
      width: 100%;
      height: 280px;
      background: linear-gradient(135deg, #667eea, #764ba2);
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 48px;
      position: relative;
      overflow: hidden;
    }

    .movie-poster::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: repeating-linear-gradient(
          45deg,
          transparent,
          transparent 2px,
          rgba(255, 255, 255, 0.1) 2px,
          rgba(255, 255, 255, 0.1) 4px
      );
      animation: shimmer 3s linear infinite;
    }

    @keyframes shimmer {
      0% { transform: translateX(-100%) translateY(-100%); }
      100% { transform: translateX(100%) translateY(100%); }
    }

    .movie-info {
      padding: 20px;
    }

    .movie-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
      margin-bottom: 8px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .movie-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
    }

    .movie-year {
      font-size: 14px;
      color: #666;
    }

    .movie-rating {
      display: flex;
      align-items: center;
      gap: 5px;
      background: #667eea;
      color: white;
      padding: 4px 8px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 600;
    }

    .movie-genres {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .genre-tag {
      background: #f0f2f5;
      color: #666;
      padding: 4px 8px;
      border-radius: 8px;
      font-size: 12px;
    }

    /* 统计卡片 */
    .stats-section {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 25px;
      margin-bottom: 40px;
    }

    .stat-card {
      background: white;
      padding: 30px;
      border-radius: 16px;
      text-align: center;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
      border: 1px solid #f0f2f5;
      transition: all 0.3s ease;
      position: relative;
      overflow: hidden;
    }

    .stat-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: linear-gradient(90deg, #667eea, #764ba2);
    }

    .stat-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    }

    .stat-icon {
      font-size: 40px;
      margin-bottom: 15px;
      background: linear-gradient(45deg, #667eea, #764ba2);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .stat-number {
      font-size: 32px;
      font-weight: bold;
      color: #333;
      margin-bottom: 8px;
    }

    .stat-label {
      font-size: 14px;
      color: #666;
      font-weight: 500;
    }

    /* 排行榜样式 */
    .ranking-list {
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    .ranking-header {
      background: linear-gradient(90deg, #667eea, #764ba2);
      color: white;
      padding: 20px 30px;
      font-size: 18px;
      font-weight: 600;
    }

    .ranking-item {
      display: flex;
      align-items: center;
      padding: 20px 30px;
      border-bottom: 1px solid #f0f2f5;
      transition: all 0.3s ease;
    }

    .ranking-item:hover {
      background: #f8f9fa;
    }

    .ranking-number {
      font-size: 18px;
      font-weight: bold;
      color: #667eea;
      width: 40px;
    }

    .ranking-content {
      flex: 1;
      margin-left: 20px;
    }

    .ranking-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
      margin-bottom: 5px;
    }

    .ranking-subtitle {
      font-size: 14px;
      color: #666;
    }

    .ranking-score {
      font-size: 20px;
      font-weight: bold;
      color: #667eea;
    }

    /* 年度榜单模块样式 */
    .annual-section {
      max-width: 1000px;
      margin: 0 auto;
    }

    .annual-header {
      text-align: center;
      margin-bottom: 40px;
    }

    .annual-title {
      font-size: 32px;
      font-weight: bold;
      color: #333;
      margin-bottom: 12px;
      background: linear-gradient(45deg, #667eea, #764ba2);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .annual-subtitle {
      font-size: 16px;
      color: #666;
      margin: 0;
    }

    .annual-options {
      display: flex;
      justify-content: center;
      margin-bottom: 40px;
    }

    .option-card {
      background: white;
      border-radius: 16px;
      padding: 32px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
      transition: all 0.3s ease;
      cursor: pointer;
      border: 2px solid transparent;
      display: flex;
      align-items: center;
      gap: 24px;
      max-width: 600px;
      width: 100%;
    }

    .main-card {
      background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    }

    .option-card:hover {
      transform: translateY(-8px);
      box-shadow: 0 20px 40px rgba(102, 126, 234, 0.15);
      border-color: #667eea;
    }

    .option-icon {
      font-size: 48px;
      flex-shrink: 0;
    }

    .option-content {
      flex: 1;
    }

    .option-title {
      font-size: 20px;
      font-weight: 600;
      color: #333;
      margin: 0 0 8px 0;
    }

    .option-desc {
      font-size: 14px;
      color: #666;
      margin: 0;
      line-height: 1.5;
    }

    .option-arrow {
      font-size: 24px;
      color: #667eea;
      font-weight: bold;
      transition: transform 0.3s ease;
    }

    .option-card:hover .option-arrow {
      transform: translateX(4px);
    }

    .feature-tags {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      flex-wrap: wrap;
    }

    .feature-tag {
      background: rgba(102, 126, 234, 0.1);
      color: #667eea;
      padding: 4px 8px;
      border-radius: 12px;
      font-size: 12px;
      font-weight: 500;
    }

    .annual-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 20px;
      background: rgba(255, 255, 255, 0.8);
      backdrop-filter: blur(20px);
      border-radius: 16px;
      padding: 32px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    }

    .stat-item {
      text-align: center;
    }

    .stat-number {
      font-size: 28px;
      font-weight: bold;
      color: #667eea;
      margin-bottom: 8px;
    }

    .stat-label {
      font-size: 14px;
      color: #666;
      font-weight: 500;
    }

    /* 响应式设计 */
    @media (max-width: 1200px) {
      .nav-menu {
        gap: 20px;
      }
      .nav-item {
        padding: 10px 16px;
        font-size: 14px;
      }
      
      .option-card {
        padding: 24px;
        flex-direction: column;
        text-align: center;
        gap: 16px;
      }
      
      .option-content {
        order: 2;
      }
      
      .option-arrow {
        order: 3;
        transform: rotate(90deg);
      }
    }

    @media (max-width: 968px) {
      .nav-container {
        flex-wrap: wrap;
        height: auto;
        padding: 15px 0;
      }

      .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 15px;
        gap: 15px;
      }

      .nav-search {
        width: 250px;
      }

      .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 20px;
      }

      .user-info {
        display: none;
      }
    }

    @media (max-width: 640px) {
      .nav-menu {
        gap: 10px;
        overflow-x: auto;
        padding: 10px 0;
      }

      .nav-item {
        padding: 8px 12px;
        font-size: 14px;
        flex-shrink: 0;
      }

      .nav-search {
        width: 200px;
      }

      .main-content {
        padding: 20px 10px;
      }

      .content-header {
        padding: 25px 20px;
      }

      .content-body {
        padding: 20px;
      }

      .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
      }
    }

    /* 添加菜单按钮 */
    .add-menu-btn {
      background: linear-gradient(45deg, #667eea, #764ba2) !important;
      border: none !important;
      border-radius: 20px !important;
      color: white !important;
      font-weight: 500 !important;
    }

    .add-menu-btn:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    }

    /* 影评相关样式 */
    .reviews-container {
      padding: 20px 0;
    }

    .hot-comments-section, .hot-movies-section, .rating-stats-section {
      margin-bottom: 40px;
    }

    .section-title {
      font-size: 20px;
      font-weight: 600;
      color: #333;
      margin-bottom: 20px;
      padding-bottom: 10px;
      border-bottom: 2px solid #f0f2f5;
    }

    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: #999;
    }

    .empty-icon {
      font-size: 48px;
      margin-bottom: 16px;
    }

    .empty-text {
      font-size: 16px;
    }

    .comment-item, .rating-item {
      background: white;
      border-radius: 12px;
      padding: 20px;
      margin-bottom: 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      transition: all 0.3s ease;
    }

    .comment-item:hover, .rating-item:hover {
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
      transform: translateY(-2px);
    }

    .comment-header, .rating-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 16px;
    }

    .movie-info {
      display: flex;
      align-items: center;
      gap: 16px;
      flex: 1;
    }

    .movie-poster {
      width: 60px;
      height: 90px;
      border-radius: 8px;
      object-fit: cover;
    }

    .movie-details {
      flex: 1;
    }

    .movie-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
      margin-bottom: 8px;
    }

    .movie-meta {
      display: flex;
      gap: 12px;
      font-size: 14px;
      color: #666;
    }

    .comment-content {
      margin-bottom: 16px;
    }

    .comment-content p {
      color: #333;
      line-height: 1.6;
      margin: 0;
    }

    .comment-footer, .rating-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      color: #999;
    }

    .rating-score {
      display: flex;
      align-items: center;
      gap: 4px;
      margin-right: 16px;
    }

    .score {
      font-size: 24px;
      font-weight: bold;
      color: #ff6b35;
    }

    .score-label {
      font-size: 14px;
      color: #666;
    }

    .comment-actions, .rating-actions {
      display: flex;
      gap: 8px;
    }

    .comment-likes {
      display: flex;
      align-items: center;
      gap: 4px;
    }

    /* 热门评论排行榜样式 */
    .hot-comments-list {
      background: white;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    .hot-comment-item {
      display: flex;
      align-items: flex-start;
      padding: 20px 30px;
      border-bottom: 1px solid #f0f2f5;
      transition: all 0.3s ease;
    }

    .hot-comment-item:hover {
      background: #f8f9fa;
    }

    .hot-comment-item:last-child {
      border-bottom: none;
    }

    .ranking-number {
      font-size: 24px;
      font-weight: bold;
      color: #667eea;
      width: 40px;
      text-align: center;
      margin-right: 20px;
    }

    .hot-comment-item:nth-child(1) .ranking-number {
      color: #ffd700;
    }

    .hot-comment-item:nth-child(2) .ranking-number {
      color: #c0c0c0;
    }

    .hot-comment-item:nth-child(3) .ranking-number {
      color: #cd7f32;
    }

    .comment-content {
      flex: 1;
    }

    .comment-text {
      font-size: 16px;
      color: #333;
      line-height: 1.6;
      margin-bottom: 12px;
    }

    .comment-meta {
      display: flex;
      align-items: center;
      gap: 16px;
      font-size: 14px;
      color: #666;
    }

    .comment-author {
      font-weight: 600;
      color: #667eea;
    }

    .comment-movie {
      color: #333;
      font-weight: 500;
    }

    /* 热门电影排行榜样式 */
    .hot-movies-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 20px;
    }

    .hot-movie-item {
      background: white;
      border-radius: 16px;
      padding: 20px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
      transition: all 0.3s ease;
      position: relative;
    }

    .hot-movie-item:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
      cursor: pointer;
    }

    .hot-movie-item .ranking-number {
      position: absolute;
      top: 15px;
      right: 15px;
      width: 30px;
      height: 30px;
      background: linear-gradient(45deg, #667eea, #764ba2);
      color: white;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: bold;
    }

    .hot-movie-item .movie-info {
      display: flex;
      gap: 16px;
    }

    .hot-movie-item .movie-poster {
      width: 80px;
      height: 120px;
      border-radius: 8px;
      object-fit: cover;
    }

    .hot-movie-item .movie-details {
      flex: 1;
    }

    .hot-movie-item .movie-title {
      font-size: 18px;
      font-weight: 600;
      color: #333;
      margin-bottom: 8px;
    }

    .hot-movie-item .movie-meta {
      display: flex;
      gap: 12px;
      margin-bottom: 12px;
      font-size: 14px;
      color: #666;
    }

    .hot-movie-item .movie-stats {
      display: flex;
      gap: 16px;
      font-size: 14px;
    }

    .avg-rating {
      color: #ff6b35;
      font-weight: 600;
    }

    .comment-count {
      color: #667eea;
      font-weight: 500;
    }

    /* 评分统计样式 */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 20px;
    }

    .stats-grid .stat-card {
      background: white;
      padding: 25px;
      border-radius: 16px;
      text-align: center;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
      border: 1px solid #f0f2f5;
      transition: all 0.3s ease;
    }

    .stats-grid .stat-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
    }

    .stats-grid .stat-icon {
      font-size: 32px;
      margin-bottom: 12px;
    }

    .stats-grid .stat-number {
      font-size: 28px;
      font-weight: bold;
      color: #333;
      margin-bottom: 6px;
    }

    .stats-grid .stat-label {
      font-size: 14px;
      color: #666;
      font-weight: 500;
    }

    /* 豆酱AI内容区域 */
    .ai-body {
      padding: 0 !important;
      margin: 0 !important;
      height: calc(100vh - 80px) !important;
    }
    
    .ai-content {
      height: 100%;
      padding: 0;
      background: transparent;
    }

    .ai-content .chat-container {
      height: 100%;
      border-radius: 0;
      box-shadow: none;
      margin: 0;
    }
  </style>